SUBROUTINE MAP
*Create a form that contains an image button showing a map of the British Isles
*When the form is submitted, display different lists according to where
*in the image was clicked

     * Include the RealWeb definitions
     INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

     * Get the URL of the Reality item server
     IMAGE = ""
     CALL RW_GET_PARAM("__isurl", IMAGE)
     * Specify the location of the image
     IMAGE = IMAGE : "/REALWEB-ITEMS/map.gif"

     * Start the HTML page
     CALL RW_START_HTML_PAGE("Event Information", "", "", "", "")

     * Start the HTML form, specifying that the subroutine MAP2
     * should be run when the form is submitted
     CALL RW_START_HTML_FORM("MAP2", "MAPFORM", "")

     CALL RW_PUT("Click on the relevant part of the map to display details of events scheduled in that area")
     CALL RW_NEWLINES(2)

     *Create the image button
     CALL RW_IMAGE_BUTTON("MAP", "Map of British Isles", IMAGE, "")

     *Complete the form
     CALL RW_END_FORM

     * Complete the page
     CALL RW_END_PAGE
RETURN
SUBROUTINE MAP2
* Display relevant list of events for map location clicked

     * Include the RealWeb definitions
     INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP

     * Start the HTML page
     CALL RW_START_HTML_PAGE("Scheduled Events", "", "", "", "")

     EQU AM TO CHAR(254)
     EQU VM TO CHAR(253)

     * Make the event lists
     VALUE_LIST1="Photographing Sea Eagles, Strathclyde University, Nov 30th 2002":AM:...
     "Winter Fun Day, Loch Insh Wood, Dec 15th 2002":AM:...
     "Orkney Bird Race, around Orkney, Jan 19th 2003"
     CALL RWA_MAKE_ULIST(LIST1, VALUE_LIST1, "")
     VALUE_LIST2="Feeding and Watching Garden Birds, Sandy, Oct 31st 2002":AM:...
     "Wildfowl Safari, Ouse Washes Nature Reserve, Nov 24th 2002"
     CALL RWA_MAKE_ULIST(LIST2, VALUE_LIST2, "")
     VALUE_LIST3="Cruise to Isles of Scilly, Oct 20th 2002":AM:...
     "Bunting Search, Prawle Point, Oct 25th 2002":AM:...
     "Owl Prowl, Totnes, Nov 2nd 2002":AM:...
     "Digital Photography Workshop, The Eden Project, Jan 10th 2003"
     CALL RWA_MAKE_ULIST(LIST3, VALUE_LIST3, "")

     *Get the coordinates of the click
     CALL RW_GET_PARAM("MAP.x", X)
     CALL RW_GET_PARAM("MAP.y", Y)

     *Display event list for selected area
     IF X >109 AND X <219 AND Y >13 AND Y <130 THEN
          CALL RW_PUT("Events in Scotland")
          CALL RW_NEWLINES(3)
          CALL RW_PUT(LIST1)
     END ELSE
          IF X >211 AND X <275 AND Y >204 AND Y <254 THEN
               CALL RW_PUT("Events in Eastern Region")
               CALL RW_NEWLINES(3)
               CALL RW_PUT(LIST2)
          END ELSE
               IF X >116 AND X <202 AND Y <331 AND Y >277 THEN
                     CALL RW_PUT("Events in the South West")
                     CALL RW_NEWLINES(3)
                     CALL RW_PUT(LIST3)
               END ELSE
                     CALL RW_PUT("There are no events scheduled in that area")
               END
          END
     END

     * Complete the page
     CALL RW_END_PAGE
RETURN

Go to top button